package com.tgm.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tgm.domain.dto.ConsumptionQueryDTO;
import com.tgm.domain.dto.HeatMapDTO;
import com.tgm.domain.dto.StatisticsPieDTO;
import com.tgm.domain.dto.StatisticsTrendDTO;
import com.tgm.domain.entity.ConsumptionRecord;
import com.tgm.domain.vo.ConsumptionShowVO;
import com.tgm.domain.vo.HeatMapVO;
import com.tgm.domain.vo.PortraitVO;
import org.apache.ibatis.annotations.MapKey;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
* @author tgm
* @description 针对表【consumption_record(消费记录表)】的数据库操作Mapper
* @createDate 2025-10-20 20:38:35
* @Entity com.tgm.domain.entity.ConsumptionRecord
*/
public interface ConsumptionRecordMapper extends BaseMapper<ConsumptionRecord> {

    /*
    * 分页查询消费记录
     */
    List<ConsumptionShowVO> queryByPage(ConsumptionQueryDTO consumptionQueryDTO);

    /*
    * 统计消费趋势
     */
    @MapKey("month")
    List<Map<String, Object>> statisticsTrend(StatisticsTrendDTO statisticsTrendDTO);

    /*
    * 统计消费类型饼图
     */
    @MapKey("merchantType")
    List<Map<String, Object>> statisticsPie(StatisticsPieDTO statisticsPieDTO);

    /*
    * 统计消费地点热力图
     */
    List<HeatMapVO> statHeatMapData(HeatMapDTO heatMapDTO);

    /*
    * 查询某个用户的消费记录，用于进行分析
     */
    List<PortraitVO> selectByUserIdAndTime(String userId, String startTime, String endTime);

    /*
    * 查出该学院或者该年级的消费特征
     */
    List<PortraitVO> selectByDepOrGrade(String department, String grade);


    // 按多条件查询消费记录
    List<PortraitVO> selectByConditions(
            String department,
            String grade
    );

    // 批量插入消费记录
    void insertBatch(List<ConsumptionRecord> consumptionRecords);
}




